use zookeeper::{ZooKeeper, WatchedEvent, Watcher, Acl, CreateMode};
use std::time::Duration;

struct LoggingWatcher;
impl Watcher for LoggingWatcher {
    fn handle(&self, e: WatchedEvent) {
        println!("{:?}", e)
    }
}

fn main() {
    let zk = ZooKeeper::connect("127.0.0.1:2181", Duration::from_secs(15),
			 LoggingWatcher).unwrap();
    let ret = zk.exists("/zookeeper", true);
    match ret {
        Ok(s) => println!("{:?}", s),
        Err(e) => println!("{:?}", e),
    };

	let path = zk.create("/test", vec![65, 66], Acl::open_unsafe().clone(),
					 	 CreateMode::Ephemeral);
    println!("created -> {:?}", path);
}
